/*
<!--
$(document).ready
(
    function()
    {
	var validateArtistname = $('#validateArtistname');
	$('#artistname').blur
	(
	    function()
	    {

                // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
                var t = this;

                // only run the check if the username has actually changed - also means we skip meta keys
                if ((this.value != this.lastValue))
                {

                        // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                        // a particular key, it will only fire when the release the key.

                        // show our holding text in the validation message space
                        validateArtistname.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16" width="16" />');

                        if(t.value.length > 0)
                        {
                                    $.ajax({
                                            url: '/inc/validate_release.inc.php',
                                            data: 'action=check_artistname&artistname=' + t.value,
                                            dataType: 'json',
                                            type: 'post',
                                            success: function (j) {
                                                    if(j.ok)
                                                            validateArtistname.html('<font color="green"><b>'+j.msg+'</b></font>');
                                                    else
                                                            validateArtistname.html('<font color="red">'+j.msg+'</font>');
                                            }
                                    });

                        }
                        else
                        {
                                validateArtistname.html('<font color="red">Wrong characters</color>');
                        }

                    if(this.value.length == 0)
                            validateArtistname.html('');
                }
                if(this.value.length == 0)
                        validateArtistname.html('');
            }
        );


	var validateReleasename = $('#validateReleasename');
	$('#releasename').blur
	(
	    function()
	    {
		// cache the 'this' instance as we need access to it
		// within a setTimeout, where 'this' is set to 'window'
		var t = this;

		// only run the check if the username has actually changed
		// - also means we skip meta keys
		if(this.value != this.lastValue)
		{

		    validateReleasename.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16" width="16" />');

                    if(t.value.length > 0)
                    {

				$.ajax
				({
					url: '/inc/validate_release.inc.php',
					data: 'action=check_releasename&releasename=' + t.value,
					dataType: 'json',
					type: 'post',
					success: function (j) {
						if(j.ok)
							validateReleasename.html('<font color="green"><b>'+j.msg+'</b></font>');
						else
							validateReleasename.html('<font color="red">'+j.msg+'</font>');
						}
				    });
                    }
		    else
		    {
			validateReleasename.html('<font color="red">Wrong characters</color>');
		    }
                        
                    if(this.value.length == 0)
                        validateReleasename.html('');

		   }


                if(this.value.length == 0)
                    validateReleasename.html('');

		}
	);
    }
);
//-->


function checkForm()
{
    var i = document.getElementById("releasename");
    var err = $('#error');
    err.html('');

    var tba = document.getElementById("tba");

    if(i.value.length == 0 && !tba.checked)
    {
            err.html('<font color="red">Please specify release name</font>');
            return false;
    }

    i = document.getElementById("artistname");

    if(i.value.length == 0)
    {
            err.html('<font color="red">Please specify artist name</font>');
            return false;
    }

    return true;
}
*/
function setTBA()
{
    var i = document.getElementById("releasename");
    var t = document.getElementById("tba");
    if(t.checked)
    {
        i.disabled = true;
        i.value = "To be announced";
    }
    else
    {
        i.disabled = false;
        i.value = "";
    }
}